package net.huosen.blog.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import net.huosen.blog.dao.IUserDao;
import net.huosen.blog.model.User;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

@Component("userDao")
public class UserDaoImpl implements IUserDao {
	@Resource(name="hibernateTemplate")
	private HibernateTemplate template;
	
	@Override
	public User queryUserByName(String userName) {
		List<User> list = template.find("from User u where u.name=?", userName);
		if(list.size()>0){
			return list.get(0);
		}else{
			return null;
		}
	}
}
